package com.mrinalwadhwa.effects.rippleblocks
{
	import com.mrinalwadhwa.effects.BendPixels;
	import flash.utils.ByteArray;
	import mx.effects.IEffectInstance;
	
	public class RippleBlocksEffect extends BendPixels{

		[Embed("RippleBlocks.pbj", mimeType="application/octet-stream")]
		private var RippleBlocksFilter:Class;

		public static const MIN_AMPLITUDE:Number = 0; 
		public static const MAX_AMPLITUDE:Number = 100; 
		public static const DEFAULT_AMPLITUDE:Number = 0; 

		public static const MIN_WAVELENGTH:Number = 1; 
		public static const MAX_WAVELENGTH:Number = 100; 
		public static const DEFAULT_WAVELENGTH:Number = 30; 

		public static const MIN_PHASE:Number = 0; 
		public static const MAX_PHASE:Number = 6.383; 
		public static const DEFAULT_PHASE:Number = 0; 


		[Inspectable(category="General")]
		public var fromXAmplitude:Number = DEFAULT_AMPLITUDE;

		[Inspectable(category="General")]
		public var fromYAmplitude:Number = DEFAULT_AMPLITUDE;

		[Inspectable(category="General")]
		public var toXAmplitude:Number = DEFAULT_AMPLITUDE;

		[Inspectable(category="General")]
		public var toYAmplitude:Number = DEFAULT_AMPLITUDE;

		[Inspectable(category="General")]
		public var fromXWavelength:Number = DEFAULT_WAVELENGTH;

		[Inspectable(category="General")]
		public var fromYWavelength:Number = DEFAULT_WAVELENGTH;

		[Inspectable(category="General")]
		public var toXWavelength:Number = DEFAULT_WAVELENGTH;

		[Inspectable(category="General")]
		public var toYWavelength:Number = DEFAULT_WAVELENGTH;

		[Inspectable(category="General")]
		public var fromXPhase:Number = DEFAULT_PHASE;

		[Inspectable(category="General")]
		public var fromYPhase:Number = DEFAULT_PHASE;

		[Inspectable(category="General")]
		public var toXPhase:Number = DEFAULT_PHASE;

		[Inspectable(category="General")]
		public var toYPhase:Number = DEFAULT_PHASE;



		public function RippleBlocksEffect(target:Object=null){
			super(target);
		}
		
        override protected function initInstance(inst:IEffectInstance):void {
			
			benderByteArray = new RippleBlocksFilter() as ByteArray
			benderParams = [
								[ 
								  'amplitude',
								  [fromXAmplitude,fromYAmplitude],
								  [toXAmplitude,toYAmplitude]
								],
								[ 
								  'phase',
								  [fromXPhase,fromYPhase],
								  [toXPhase,toYPhase]
								],
								[ 
								  'wavelength',
								  [fromXWavelength,fromYWavelength],
								  [toXWavelength,toYWavelength]
								]

							];	
							
            super.initInstance(inst);
        } 		

	}
}